import { Injectable } from '@angular/core';
import {Md5} from 'ts-md5/dist/md5';

import {ConfigProvider} from './config.provider';
import * as moment from 'moment';

/*
* 安全服务
*/
@Injectable()
export class SecurityProvider {

    public static get Authentication(): string {
        const ts = moment().unix();
        const szWaitSign = ConfigProvider.AppKey + '|' + ts + '|' + ConfigProvider.AppSecret;

        const szSign = Md5.hashStr(szWaitSign).toString();
        return ConfigProvider.AppKey + '|' + ts + '|' + szSign;
    }
}
